'''
Created on 2012. 2. 19.

@author: weonseoggim
'''


import cgi
import os

from google.appengine.api import images
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.api.datastore_types import Blob
from google.appengine.ext import blobstore

class DataStore(db.Model):
    '''
    classdocs
    '''


    def __init__(self,params=None):
        '''
        Constructor
        '''
    

class Album(db.Model):
    name = db.StringProperty()
    creator = db.UserProperty()
    created_date = db.DateTimeProperty(auto_now_add=True)

class Picture(db.Model):
    
    submitter = db.UserProperty()
    submitted_date = db.DateTimeProperty(auto_now_add=True)
    title = db.StringProperty() #제목.
    writter = db.StringProperty() #작가
    category = db.StringProperty() #카테고리..
    caption = db.StringProperty(multiline=True)
    album = db.ReferenceProperty(Album, collection_name='pictures')
    tags = db.StringListProperty()
    data = db.BlobProperty() #상세 .
    thumbnail_data = db.BlobProperty()

class Book(db.Model):
    submiter = db.UserProperty()
    submitted_date=db.DateTimeProperty(auto_now_add=True)
    picture = db.ReferenceProperty(Picture, collection_name='books')
    blobkey = blobstore.BlobReferenceProperty()

#    blobkey = db.ReferenceProperty(Blob,collection_name='bookfiles')



class Product(db.Model):
    '''
    classdocs
    '''
    submiter = db.UserProperty()
    submitted_date=db.DateTimeProperty(auto_now_add=True)
    title = db.StringProperty()
    caption = db.StringProperty(multiline=True)
    album = db.ReferenceProperty(Album, collection_name='products')
    tags = db.StringListProperty()
    datakey = db.BlobKey
    


        